package com.yunfeisoft.common.base;

import org.joda.time.DateTime;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

@MappedSuperclass
public class BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    //主键
    @Id
    @Column
    protected String id;

    @Column
    protected String createId;

    @Column
    protected Date createTime;

    @Column
    protected String modifyId;

    @Column
    protected Date modifyTime;

    /**
     * 是否删除，1是 2否
     */
    @Column
    protected Integer isDel;

    protected Integer exists;

    public String getCreateTimeStr() {
        return new DateTime(createTime).toString("yyyy-MM-dd HH:mm:ss");
    }

    public String getModifyTimeStr() {
        return new DateTime(modifyTime).toString("yyyy-MM-dd HH:mm:ss");
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateId() {
        return createId;
    }

    public void setCreateId(String createId) {
        this.createId = createId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getModifyId() {
        return modifyId;
    }

    public void setModifyId(String modifyId) {
        this.modifyId = modifyId;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Integer getIsDel() {
        return isDel;
    }

    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }

    public Integer getExists() {
        return exists;
    }

    public void setExists(Integer exists) {
        this.exists = exists;
    }
}
